from django.contrib import admin
from .models import Role, UserProfile, CustomerInfo, Hospital

admin.site.site_header = '青蛙管理系统'  # 设置header
admin.site.site_title = '青蛙管理系统'  # 设置title
admin.site.index_title = '青蛙管理系统'


class RoleAdmin(admin.ModelAdmin):
    list_display = ['name']
    search_fields = ['name']


admin.site.register(Role, RoleAdmin)


class UserAdmin(admin.ModelAdmin):
    list_display = ['name', 'sex', 'avatar']
    list_filter = ['role__name']


admin.site.register(UserProfile, UserAdmin)


class CustomerInfoAdmin(admin.ModelAdmin):
    list_display = ['name', 'contact', 'source', 'status', 'consultant',
                    'create_date']
    search_fields = ['name']


admin.site.register(CustomerInfo, CustomerInfoAdmin)


class HospitalAdmin(admin.ModelAdmin):
    list_display = ['name', 'address']
    search_fields = ['name']


admin.site.register(Hospital, HospitalAdmin)
